<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> 
<script type="text/javascript">
$(document).ready(function() {    
	$(":input[name='startDate']").datepicker({
		defaultDate:"+lw",
		//monthNames:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],
		changeMonth: false,      
		changeYear: true,
		//maxDate:new Date(),
		dateFormat:"yy-mm-dd",
		onClose: function(selectedDate){
			$(":input[name='endDate']").datepicker("option", "minDate", selectedDate);
		}
	});
	$(":input[name='endDate']").datepicker({
		defaultDate:"+lw",
		//monthNames:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],
		changeMonth: false,      
		changeYear: true,
		//maxDate:new Date(),
		dateFormat:"yy-mm-dd",
		onClose: function(selectedDate){
			$(":input[name='startDate']").datepicker("option", "maxDate", selectedDate);
		}
	});
	
	//var startDate = $(":input[name='startDate']").datepicker("getDate");//date타입으로 값 가져오기
	//var endDate = $(":input[name='startDate']").datepicker("getDate");
});
</script>
<title>신청일자 확인</title>
</head>
<body><center>
<c:choose>
	<c:when test="${not empty sessionScope.user }">
		<h3><font color="blue">&lt; ${user.name } 님의 신청일자 조회 &gt;</font></h3>
	</c:when>
	<c:otherwise>
		<font color="red">로그인후 접근하세요.</font><br>
		<a href='/${initParam.context_root}/mainView.do'>[ 메인으로 ]</a>
	</c:otherwise>
</c:choose>
	<form action="./checkDate.do" method="post">
		날짜조회  <input type="text" name="startDate"> &nbsp;~  &nbsp;<input type="text" name="endDate"> &nbsp;
		<input type="submit" value="조회">
		<br>
	</form>
	<br>
	<table cellspacing="0" cellpadding="3" border="1" width="530px">
		<tr>
			<th width="40%">날짜</th><th width="40%">시간</th><th>승인자</th>
		</tr>
		<c:forEach items="${selectServiceRequestList }" var="approDate" varStatus="i">
			<tr>
				<td>
					<fmt:formatDate var ="strStartDate" value="${approDate.calendarStart }" type="date" pattern="yyyy-MM-dd"/>
					<fmt:formatDate var ="strEndDate" value="${approDate.calendarEnd }" type="date" pattern="yyyy-MM-dd"/>
					<c:out value="${strStartDate} ~ ${strEndDate }"/>
				</td>
				<td><c:out value="${approDate.timeStart } ~ ${approDate.timeEnd }"/></td>
				<td><c:out value="${approDate.approName }"/></td>
			</tr>
		</c:forEach>
		
	</table>
	<br>
	<div align="right" style="padding-right: 20px">
	
		<input type="button" value="닫기" onclick="javascript:window.close()">
	</div>
</center>
</body>
</html>